package com.mhs.map;

import android.content.Intent;
import android.os.Bundle;

import com.google.android.maps.GeoPoint;
import com.google.android.maps.MapActivity;
import com.google.android.maps.MapView;
import com.google.android.maps.MyLocationOverlay;
import com.mhs.mhs_gui.R;

public class GetMyLocation extends MapActivity{
	MyLocationOverlay myLocationOverlay;
	MapView mapView;
	@Override
	protected void onCreate(Bundle icicle) {
		super.onCreate(icicle);
		setContentView(R.layout.googlemap);
		mapView = (MapView) findViewById(R.id.MapView);
		myLocationOverlay = new MyLocationOverlay(this, mapView);
//		myLocationOverlay.runOnFirstFix(new Runnable() {
//			public void run() {
//				mapView.getController().animateTo(myLocationOverlay.getMyLocation());
//			}
//		});
		Intent serviceGetHospitalNear = new Intent(GetMyLocation.this, GetHospitalNear.class);
		GeoPoint geoPoint = myLocationOverlay.getMyLocation();
		int latitude = geoPoint.getLatitudeE6();
		int longitude = geoPoint.getLongitudeE6();
		
		Bundle myData = new Bundle();
		myData.putInt("latitude", latitude);
		myData.putInt("longitude", longitude);
		
		serviceGetHospitalNear.putExtras(myData);
		startService(serviceGetHospitalNear);
	}
	
	@Override
	protected boolean isRouteDisplayed() {
		// TODO Auto-generated method stub
		return false;
	}

}
